import Vue from 'vue';
import Vuex from 'vuex'
Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
   catchPages: ["Home",'Agency']
  },
  mutations: {
    add(state, item) {
      if (state.catchPages.indexOf(item) === -1)
        state.catchPages.push(item);
    },
    remove(state, item) {
      let index = state.catchPages.indexOf(item);
      console.log(index)
      if(index >0)
        state.catchPages.splice(index, 1)
    },
  },
  actions: {
    add(state, item) {
      state.commit('add', item)
    },
    remove(state, item) {
      state.commit('remove', item)
    }
  },
  getters: {
    catchPages(context) {
      return context.catchPages;
    }
  }
})
export default store